home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / fpu881 / src6.zoo / sprintf.c < prev    next >
C/C++ Source or Header  |  1991-09-24  |  769b  |  44 lines

  1. #define __SRC__
  2. #include <stdarg.h>
  3. #include <stdio.h>
  4. #include <limits.h>
  5.  
  6. #if 0
  7. static int sputc(c, s)
  8.     int c;
  9.     char **s;
  10.     {
  11.     return(*(*s)++ = c);
  12.     }
  13. #endif
  14.  
  15. sprintf(buf, fmt, arg)
  16.     char *buf;
  17.     const char *fmt;
  18.     int arg;
  19.     {
  20.     register int n;
  21.     FILE sf = 
  22.     {0L, (unsigned char *)buf, (unsigned char *)buf,
  23.          _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
  24.     
  25.     n = _doprnt(&sf, fmt, &arg);
  26.     *(sf._ptr) = '\0';        /* always tie of the string */
  27.     return(n);
  28.     }
  29.  
  30. vsprintf(buf, fmt, args)
  31.     char *buf;
  32.     const char *fmt;
  33.     va_list args;
  34.     {
  35.     register int n;
  36.     FILE sf = 
  37.     {0L, (unsigned char *)buf, (unsigned char *)buf,
  38.          _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
  39.  
  40.     n = _doprnt(&sf, fmt, args);
  41.     *(sf._ptr) = '\0';        /* always tie of the string */
  42.     return(n);
  43.     }
  44.